package dao;

import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author chenpeng
 * @date 2018/5/18 22:01
 */
public interface EmployeeMapper {
    //多条记录封装一个map：Map<Integer,Employee>:键是这条记录的主键，值是封装后的javaBean
    //告诉mybatis封装这个map的时候使用哪个属性作为map的key
    @MapKey("id")
    Map<Integer,Employee> getEmpByLastNameLikeReturnMap(String lastName);

    Map<String,Object> getEmpByIDReturnMap(Integer id);


    List<Employee> getEmpsByLastNameLike(String lastName);

    Employee selectByMap(Map<String ,Object> map);

    Employee selectByIdAndLastName(@Param("id") Integer id,@Param("lastName") String lastName);

    Employee selectById(Integer id);
    Long addEmp(Employee employee);
    void updateEmp(Employee employee);
    void deleteEmpById(Integer id);
}
